﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace l1cs.server.serverpackets
{
    public class S_ChangeShape : ServerBasePacket
    {
        private byte[] _byte = null;

        public S_ChangeShape( int objId, int polyId )
        {
            buildPacket( objId, polyId, false );
        }

        public S_ChangeShape( int objId, int polyId, bool weaponTakeoff )
        {
            buildPacket( objId, polyId, weaponTakeoff );
        }

        private void buildPacket( int objId, int polyId, bool weaponTakeoff )
        {
            writeC( Opcodes.S_OPCODE_POLY );
            writeD( objId );
            writeH( polyId );
            // 何故29なのか不明
            writeH( weaponTakeoff ? 0 : 29 );
        }

        override
        public byte[] getContent()
        {
            if ( _byte == null )
            {
                _byte = getBytes();
            }
            return _byte;
        }

        override public String getType()
        {
            return "[S] S_ChangeShape";
        }
    }
}
